Repository navigation
Conversation
API v1's revision 4e30076d4b9f drops reports.label, description and user_id, report_runs.trigger and its four cliff columns, and budget_window_runs.trigger, with the foreign key, index and check on them. The models still map all of them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Report loses label, description and user_id, with its key to users and that column's index. ReportRun loses trigger and its four cliff columns, with their check. BudgetWindowRun loses trigger. ReportRunTrigger and ReferencedUser have no other use, so they go too. No statement named these columns already, apart from the models themselves, so the models work on a database that still has them, where new rows leave them null, and on one without them. The test fixtures stop writing them so they run against both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fixture selected every column the model maps, so it would fail on a database without one of them, whichever release it tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_tables counted eight enum columns, two of them the trigger columns. test_mapped_classes repeated the foreign key total test_tables already checks along with the keys themselves, so it no longer states one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two completion tests lost what they checked when the report run's cliff columns went, so they now check that no cliff_impacts row appears. Also drop two names that came from the removed trigger values and the remaining notes that shared rows hold no label, user or trigger, which no longer describe any column. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With no cliff_impacts row seeded, the two completion tests could not see an update of one, and the Modal worker role can't insert one. They now seed a pending result for each side and check it stays unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1110
Sim's mapped classes of
reports,report_runsandbudget_window_runsno longer declare the nine columns that API v1's revision4e30076d4b9fdrops (PolicyEngine/policyengine-api#4335, C1 · 41), or the foreign key, index and check constraint it drops with them.Stacked on #1096 (C1 · 38), and based on its branch. #1096 stops the v2 runtime writing
report_runs' four cliff columns. Retarget this tomainonce #1096 merges.What must merge first:
libs/policyengine-simulation-persistence/public-api-committo its merge commit. Until then the pin stays at63cce8273.What changed
Reportno longer declareslabel,description,user_id,fk_reports_user_id_usersorix_reports_user_id.ReportRunno longer declarestrigger,baseline_cliff_gap,baseline_cliff_share,reform_cliff_gap,reform_cliff_shareorck_report_runs_cliff_impact_complete.BudgetWindowRunno longer declarestrigger.recalculatestays.ReportRunTrigger, the enum of the twotriggercolumns, andReferencedUser, the model ofusersthat onlyreports.user_idreferenced, had no other use, so they are removed with their exports. Sim's foreign keys to API v1's tables go from 20 to 19, and its enum columns from 8 to 6.test_a_model_maps_none_of_the_columns_api_v1_dropsandtest_a_model_declares_no_constraint_or_index_api_v1_drops, fail if any of them returns.c1-42-drop-report-columns.removed.md.With #1096, no statement names these columns, and none selects or inserts whole rows of these three classes, so the change removes declarations only.
Deploy order
This release and C1 · 41's revision can be applied in either order, as long as a sim release with #1096 is in production first. C1 · 41 already requires that.
No deployed code compares these tables with the models: the live schema check in
validation.pycovers only thestage12_evaluation_*tables.Tests expected to fail until the pin moves
The pinned commit
63cce8273still has the nine columns, sotests/test_public_api_schema.py::test_the_models_match_the_public_api_tablesfails with 12 differences: the nine columns, the foreign key, the index and the check. It passes oncepublic-api-commitnames #4335's merge commit.The pinned schema also has no
cliff_impacts(PolicyEngine/policyengine-api#4327, C1 · 37). Until #1096 moves the pin to #4327's merge commit, #1096's own expected failures remain:test_the_cliff_calculation_model_matches_the_api_v1_table;test_modal_worker_writes.pyand two intest_service_writes.py;test_cliff_result_store.py.Two tests this PR changes join them, because they seed
cliff_impactsrows:test_completing_a_report_run_with_a_cliff_impact_leaves_cliff_results_aloneandtest_an_output_without_labour_supply_or_cliff_impact_stores_neither.While this PR is stacked, it runs only
CI complete, which fails and says so, plusPR descriptionandChangelog fragment.If PolicyEngine/policyengine-api#4325 merges before #4335, moving the pin also brings its
dynamicschange. The models need nothing for that, but theinsert_dynamictest helper inpublic_api_rows.pywritesdynamics.name, which #4325 drops.Tests
Test-first:
a60c082fadds the failing guard tests before the change. Only selected tests ran, each by node ID. They ran against two disposable PostgreSQL 17 databases, each built with API v1's migration chain and privilege manifest:without: API v1 at C1 · 41'sc4c08ce74, revision4e30076d4b9f. #4335's later commits leave the revision'supgrade()and the grants unchanged.with: its parentad4060469, revisionbc334f9877b7, which still has the columns.withoutwithtest_the_models_match_the_public_api_tablesfails with the 12 differences aboveThe service cases cover creates, re-runs, budget windows, and writes by both database roles. The runtime cases cover report run completion, the budget window store, household runs, the stuck-run sweep and cliff results.
Sim's checks pass: the pinned Ruff format and lint, the rules registry, the quality guards including file length, the lock checks, and Pyright for the two persistence libraries and the entry project.
Review
Two review rounds.
a84a6f1d.decbea8d: the two completion tests seed a pending cliff result for each side and require it unchanged. They fail when completion is changed to update those rows.Overlap with #1099
#1099 (C1 · 39) is also based on #1096's branch. Merging both conflicts in
docs/migration/stage-12-modal-worker-foundation.md,keyed_economy_records.pyand the entry project'sREADME.md, all in documentation or docstrings. Whichever merges second resolves them.🤖 Generated with Claude Code